import copy

n = int(input())
k = int(input())

path = []
result = []


def backtracking(start_index):
    if len(path) == k:
        result.append(copy.deepcopy(path))
        return
    if len(path) + n - start_index < k:
        return
        pass
    for i in range(start_index + 1, n + 1):
        path.append(i)
        backtracking(i)
        path.pop()


backtracking(0)
print(result)
